home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
tex
/
td187src.lzh
/
MTPOPUPS.I
< prev
next >
Wrap
Text File
|
1991-06-08
|
17KB
|
549 lines
(*#######################################################################
M A G I C P O P U P S
#######################################################################
V1.01 19.11.90 Peter Hellinger Popups können jetzt analog zu
den MagicDials verschoben werden
V1.00 21.10.90 Peter Hellinger
V0.01 02.09.90 Peter Hellinger
#######################################################################*)
IMPLEMENTATION MODULE mtPopups;
(*------------------------------*)
(* COMPILERSWITCHES *)
(*------------------------------*)
(* TDI-Version: DEAKTIVIERT *)
(*------------------------------*)
(* V- Overflow-Checks *)
(* R- Range-Checks *)
(* S- Stack-Check *)
(* N- NIL-Checks *)
(* T- TDI-Compiler vor 3.01 *)
(* Q+ Branch statt Jumps *)
(* *)
(*------------------------------*)
(* MM2-Version: AKTIVIERT *)
(*------------------------------*)
(*$R- Range-Checks *)
(*$S- Stack-Check *)
(* *)
(*------------------------------*)
FROM SYSTEM IMPORT ADDRESS, ADR;
FROM Storage IMPORT ALLOCATE, DEALLOCATE;
FROM MagicSys IMPORT Nil, Null, Bit0, Bit1, Bit2, Bit3, Bit4, Bit5, Bit6, Bit7,
Bit8, Bit9, Bit10, Bit11, Bit12, Bit13, Bit14, Bit15,
LOC, Byte, ByteSet, sWORD, sINTEGER, sCARDINAL, sBITSET,
lWORD, lINTEGER, lCARDINAL, lBITSET,
CastToChar, CastToByte, CastToByteset, CastToInt,
CastToCard, CastToBitset, CastToWord, CastToLInt,
CastToLCard, CastToLBitset, CastToLWord, CastToAddr;
FROM MagicAES IMPORT GBOX, GTEXT, GBOXTEXT, GIBOX, GSTRING, GTITLE,
Exit, DISABLED, OBJECT, ObjcDraw, ObjcFind, TEDINFO,
BEGMCTRL, ENDMCTRL, WindUpdate, WFFULLXYWH, WindGet,
FormButton, GrafHandle, MUKEYBD, MUBUTTON, MUM1,
MUM2, MUMESAG, MUTIMER, EvntMulti, AESIntIn, AESIntOut,
AESCall;
FROM mtAppl IMPORT VDIHandle, MouseOn, MouseOff, MouseArrow, MouseHand;
FROM mtArea IMPORT AREA, NewAREA, DisposeAREA, FreeArea, SaveArea,
CopyArea, RestoreArea, MOVEUP, MOVEDOWN, MOVELEFT,
MOVERIGHT, MoveArea;
FROM MagicStrings IMPORT Assign, Append, Length;
IMPORT MagicAES, MagicVDI;
TYPE tRect = RECORD
x: sINTEGER;
y: sINTEGER;
w: sINTEGER;
h: sINTEGER;
END;
TYPE obTree = POINTER TO ARRAY [0..1000] OF MagicAES.OBJECT;
tString = ARRAY [0..40] OF CHAR;
tTedPtr = POINTER TO TEDINFO;
VAR Main: ARRAY [0..51] OF OBJECT;
MainTitle: TEDINFO;
Sub: ARRAY [0..51] OF OBJECT;
SubTitle: TEDINFO;
mainArea: AREA;
subArea: AREA;
frontArea: AREA;
SubBegin: sINTEGER;
b: sBITSET;
bool, rekExit: BOOLEAN;
screen: tRect;
chW, chH: sINTEGER;
bW, bH: sINTEGER;
mW, mH: sINTEGER;
PROCEDURE scanType (t: obTree; entry, flag: sINTEGER): sINTEGER;
(* Scannt nach einem bestimmten Typflag *)
VAR o, r: INTEGER;
BEGIN
o:= entry;
WHILE (o >= entry) DO
WITH t^[o] DO
IF flag = obType THEN rekExit:= TRUE; RETURN o; END;
IF (obHead > -1) THEN
r:= scanType (t, obHead, flag);
IF rekExit THEN RETURN r; END;
END;
o:= obNext;
END;
END;
RETURN 0;
END scanType;
PROCEDURE SameLength (menu: obTree; num, max: sINTEGER);
VAR i: sINTEGER;
BEGIN
FOR i:= 0 TO num - 1 DO menu^[i].obWidth:= max; END;
END SameLength;
PROCEDURE PosMenu (menu: obTree; ob, maxW, maxH: sINTEGER);
VAR x, y: sINTEGER;
b: sBITSET;
BEGIN
WITH menu^[0] DO
IF ob > 0 THEN
x:= Main[0].obX + Main[ob].obX + (Main[ob].obWidth DIV 2);
y:= Main[0].obY + Main[ob].obY - (chW DIV 2);
ELSE
MagicAES.GrafMkstate (x, y, b, b);
END;
obX:= x; obY:= y; obWidth:= maxW; obHeight:= maxH;
IF (obX + obWidth) > mW THEN obX:= mW - obWidth - 1; END;
IF (obY + obHeight) > mH THEN obY:= mH - obHeight - 1; END;
IF obX < screen.x THEN obX:= screen.x + 1; END;
IF obY < screen.y THEN obY:= screen.y + 1; END;
END;
END PosMenu;
PROCEDURE calcArea (tree: obTree; VAR frame: sINTEGER; VAR r: tRect);
(* berechnet das umgebende Rechteck des Basis-Objekts *)
VAR x: sINTEGER;
BEGIN
frame:= ORD(tree^[0].Box.frame) + 1;
IF (frame > 127) THEN frame:= 257 - frame; END;
r.x:= tree^[0].obX - frame;
r.y:= tree^[0].obY - frame;
r.w:= tree^[0].obWidth + (frame * 2);
r.h:= tree^[0].obHeight + (frame * 2);
END calcArea;
PROCEDURE DoEvent (VAR x, y: sINTEGER;
VAR button: sBITSET;
VAR scan: sINTEGER): sBITSET;
VAR event: sBITSET;
i: sINTEGER;
split: RECORD
CASE: BOOLEAN OF
TRUE: wert: sINTEGER;|
FALSE: hi: CHAR;
lo: CHAR;|
END;
END;
BEGIN
(* Array's laden *)
event:= {MUKEYBD, MUTIMER, MUBUTTON};
AESIntIn[ 0]:= CastToInt (event);
AESIntIn[ 1]:= 257;
AESIntIn[ 2]:= 3;
AESIntIn[ 3]:= 0;
AESIntIn[14]:= 0;
AESIntIn[15]:= 0;
i:= AESCall(25, 16, 7, 1, 0);
event:= CastToBitset (i);
x:= AESIntOut[1];
y:= AESIntOut[2];
button:= CastToBitset (AESIntOut[3]);
(* kbshift:= CastToBitset (AESIntOut[4]); *)
split.wert:= AESIntOut[5];
scan:= CastToInt (split.hi);
(* ascii:= split.lo; *)
RETURN event;
END DoEvent;
PROCEDURE ScreenDim (VAR cw, ch, bw, bh, mw, mh: sINTEGER);
VAR i: sINTEGER;
BEGIN
MagicAES.GrafHandle (i, cw, ch, bw, bh);
MagicAES.WindGet (0, 7, screen);
mw:= screen.x + screen.w - 1;
mh:= screen.y + screen.h - 1;
END ScreenDim;
PROCEDURE Entprelle;
VAR x, y: sINTEGER;
button: sBITSET;
BEGIN
REPEAT
MagicAES.GrafMkstate (x, y, button, b);
UNTIL button = {};
END Entprelle;
PROCEDURE DoMenu (t: obTree; area: AREA): sINTEGER;
CONST Links = Bit0;
Rechts = Bit1;
VAR x, y, ox, oy, i, f, j, o, d, xx, yy: sINTEGER;
ob, oldob, taste, scan, clicks: sINTEGER;
button, kbshift, event: sBITSET;
ascii: CHAR;
fr: tRect;
PROCEDURE DrawBar (o: sINTEGER);
VAR r: tRect;
BEGIN
IF o > 0 THEN
r.x:= t^[0].obX + t^[o].obX;
r.y:= t^[0].obY + t^[o].obY;
r.w:= r.x + t^[o].obWidth - 1;
r.h:= r.y + t^[o].obHeight - 1;
MagicVDI.Bar (VDIHandle, r);
END;
END DrawBar;
BEGIN
i:= MagicVDI.SetWritemode (VDIHandle, MagicVDI.XOR);
i:= MagicVDI.SetFillcolor (VDIHandle, 1);
bool:= MagicVDI.SetFillperimeter (VDIHandle, FALSE);
oldob:= -1; ob:= -1; ox:= -1; oy:= -1;
WindUpdate (BEGMCTRL);
LOOP
event:= DoEvent (x, y, button, scan);
(* Objekt finden *)
IF (x # ox) OR (y # oy) THEN
ob:= MagicAES.ObjcFind (t, 0, 999, x, y);
ox:= x;
oy:= y;
END;
IF (MUKEYBD IN event) THEN
CASE scan OF
114,
28: (* Objekt selektiert *)
MouseOff; DrawBar (oldob); MouseOn; EXIT;|
72: o:= ob;
IF o > 2 THEN
DEC (o);
IF (DISABLED IN t^[o].obState) THEN DEC (o); END;
IF o >= 2 THEN ob:= o; END;
ELSE
ob:= t^[0].obTail;
END;
|
80: o:= ob;
IF (o < t^[0].obTail) AND (o > 1) THEN
INC (o);
IF (DISABLED IN t^[o].obState) THEN INC (o); END;
IF o <= t^[0].obTail THEN ob:= o; END;
ELSE
ob:= 2;
END;
|
97: MouseOff; DrawBar (oldob); MouseOn; ob:= -1; EXIT;
|
ELSE ;
END;
END;
(* Rechte Maustaste? *)
IF (MUBUTTON IN event) AND